import http from "../utils/http";
//课程列表
interface ConditionType {
  lv1: string;
  lv2?: string;
}
export const courseGet = (
  condition: ConditionType = {} as ConditionType,
  page: number = 1
) => {
  if (condition.lv2 == "all") {
    delete condition.lv2;
  }
  let skip = (page - 1) * 10;
  return http.get("classes/ReactArticle", {
    params: {
      limit: 10,
      skip,
      where: condition,
    },
  });
};

//分类列表

export const categoryGet = () => {
  return http.get("classes/ReactCategory");
};

//详情页
export const detailGet = (id: string) => {
  return http.get(`classes/ReactArticle/${id}`);
};
